Skip to content

fix batch create stream and make SetHostSocket thread safe#2938

Merged
chenBright merged 1 commit intoapache:masterfrom
jenrryyou:fix_batch_create_stream
Apr 18, 2025
Merged

fix batch create stream and make SetHostSocket thread safe#2938
chenBright merged 1 commit intoapache:masterfrom
jenrryyou:fix_batch_create_stream

Conversation

@jenrryyou
Copy link
Copy Markdown
Contributor

@jenrryyou jenrryyou commented Apr 5, 2025

What problem does this PR solve?

修复#2754合入后发现的问题:

  1. 有一处存在use after free;

  2. SetHostSocket可能会并发调用,增加并发安全性;

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):
    完全兼容


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@jenrryyou jenrryyou force-pushed the fix_batch_create_stream branch 4 times, most recently from 5b8021a to 41f3c2c Compare April 6, 2025 04:03
Comment thread src/brpc/stream_impl.h Outdated
butil::IOBuf *_pending_buf;
int64_t _start_idle_timer_us;
bthread_timer_t _idle_timer;
std::once_flag set_host_socket_flag;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

私有成员用 _ 开头

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jenrryyou jenrryyou force-pushed the fix_batch_create_stream branch from 41f3c2c to 882977b Compare April 6, 2025 12:06
@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented Apr 7, 2025

LGTM

@jenrryyou
Copy link
Copy Markdown
Contributor Author

辛苦大佬帮忙merge下 @wwbmmm

Copy link
Copy Markdown
Contributor

@chenBright chenBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenBright chenBright merged commit 1337db0 into apache:master Apr 18, 2025
21 checks passed
yanglimingcn pushed a commit to yanglimingcn/brpc that referenced this pull request May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants